#include "plaintext.h"

Plaintext::Plaintext() : mx(nullptr), N(0), slots(0), l(0) {}

Plaintext::Plaintext(uint64_t *mx, long N, long slots, long l) : mx(mx), N(N), slots(slots), l(l) {}

Plaintext::Plaintext(const Plaintext &ptxt) : N(ptxt.N), slots(ptxt.slots), l(ptxt.l)
{
    mx = new uint64_t[N * l];
    for (long i = 0; i < N * l; i++) {
        mx[i] = ptxt.mx[i];
    }
}

Plaintext &Plaintext::operator = (const Plaintext &ptxt)
{
    if (this == &ptxt) {
        return *this;
    }
    delete[] mx;
    N = ptxt.N;
    l = ptxt.l;
    slots = ptxt.slots;
    mx = new uint64_t[N * l];
    for (long i = 0; i < N * l; i++) {
        mx[i] = ptxt.mx[i];
    }
    return *this;
}
